<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<div th:insert="~{common/common::common}"/>
<head>
    <meta charset="UTF-8">
    <title>task</title>
</head>
<body>
    <div th:replace="~{common/leftnavbar::leftnav}"></div>
    <div class="layui-body" style="padding-left:75px;">
        <div class="demoTable" style="padding-top: 10px;">
            搜索TaskID：
            <div class="layui-inline">
                <input class="layui-input" name="id" id="demoReload" autocomplete="off">
            </div>
            <button class="layui-btn" data-type="reload">搜索</button>
        </div>
        <table class="layui-hide" id="LAY_table_user" lay-filter="user"></table>
    </div>
</body>
<script type="text/javascript">
    layui.use('table', function(){
        var table = layui.table, $ = layui.$;

        //方法级渲染
        var t = table.render({
            elem: '#LAY_table_user'
            ,url: '/ts'
            ,parseData: function(res){ //res 即为原始返回的数据
                return {
                    "code": res.code,
                    "count": res.data.total,
                    "data": res.data.list
                };
            }
            ,cols: [
                [
                    {field:'taskid', title: '任务ID', width:100, sort: true, fixed: true}
                    ,{field:'taskName', title: 'SessionID', width:120}
                    //,{field:'taskParam', title: '任务参数',width:400}
                    ,{field:'createTime', title: '任务创建时间', width:120}
                    ,{field:'startTime', title: '任务开始时间', width:120}
                    ,{field:'finishTime', title: '任务完成时间', width:120}
                    ,{field:'taskType', title: '任务类型', width:160}
                    //,{field:'taskStatus', title: '任务状态'}
                ]
            ]
            ,id: 'testReload'
            ,page: true
            ,height: 'full-70'
        });

        $('.demoTable .layui-btn').on('click', function(){
            var demoReload = $('#demoReload');
            t.reload({
                page: {
                    curr: 1
                }
                ,where: {
                    taskId: demoReload.val()
                }
            })
        });
    });

    function accessfunc() {
        if (document.getElementById("access").getAttribute("class")=="layui-nav-item layui-nav-itemed"){
            document.getElementById("access").setAttribute("class", "layui-nav-item");
        } else {
            document.getElementById("access").setAttribute("class", "layui-nav-item layui-nav-itemed");
        }
    }
    function categoryfunc() {
        if (document.getElementById("category").getAttribute("class")=="layui-nav-item layui-nav-itemed"){
            document.getElementById("category").setAttribute("class", "layui-nav-item");
        } else {
            document.getElementById("category").setAttribute("class", "layui-nav-item layui-nav-itemed");
        }
    }
</script>
</html>